
import java.util.Arrays;
import java.util.Objects;
    class MyArrays<T>{
        public Object[]arr=new Object[10];
        public T getPos(int pos){
            return (T) this.arr[pos];
        }
        public void setPos(int pos,T val){
            this.arr[pos]=val;
        }
    }

    public class Text {
        public static void main1(String[] args) {

        }

        public static void main2(String[] args) {
            MyArrays<Integer> myArrays = new MyArrays<>();
            myArrays.setPos(2, 10);
            int ret = myArrays.getPos(2);
            System.out.println(ret);
        }

        public static void rotate(int l, int r, int[] arr) {
            int mid = (l + r) / 2;
            while (l <= r) {
                int tmp = arr[l];
                arr[l] = arr[r];
                arr[r] = tmp;
                l++;
                r--;
            }
        }

        public static void main(String[] args) {
            int[]arr={1,2,3,4};
            int k=2;
            rotate(0, arr.length-1,arr);
            rotate(0,k-1,arr);
            rotate(k, arr.length-1,arr);
            System.out.println(Arrays.toString(arr));
        }
    }

